#include<stdio.h>
int A[2000000];
int G[10000];
int cnt = 0;
void InsertionSort(int n,int g)
{
    for(int i = g; i < n; i++)
    {
        int temp = A[i];
        int j;
        for(j = i; j >= g; j-=g)
        {
            if(temp < A[j-g])
            {
                A[j] = A[j-g];
                cnt++;
            }
            else break;
        }
        A[j] = temp;
    }
}
int main()
{
    freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n;i++)
    {
        scanf("%d",&A[i]);
    }
    int m;
    int count = 0;
    for(int m = n/2; m > 0 ; m/=2)
    {
        count++;
    }
    printf("%d\n",count);
    for(m = n/2; m > 0; m/=2)
    {
        printf("%d ",m);
    }
    printf("\n");
    for(m = n/2; m > 0; m/=2)
    {
        InsertionSort(n,m);
    }
    printf("%d",cnt);
    for(int i = 0; i < n ; i++) printf("%d\n",A[i]);
}